class CreateSspReportItems < ActiveRecord::Migration[5.0]
  def change
    change_table :ssp_reports do |t|
      t.remove  :data
      t.remove  :commodity_id
      t.remove  :price
      t.remove  :count

      t.integer :items_count
      t.integer :price_sum
      t.integer :count_sum
    end

    create_table :ssp_report_items do |t|
      t.integer :report_id
      t.index   :report_id

      t.integer :commodity_id
      t.integer :price
      t.integer :count

      t.timestamps
    end
  end
end
